package shmallarchitect.jpa.entities;
// Generated 2009-08-23 21:22:13 by Hibernate Tools 3.2.1.GA


import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Gallery generated by hbm2java
 */
@Entity
@Table(name="gallery"
    ,catalog="shmall_architect"
)
public class Gallery  implements java.io.Serializable {

     private Long id;
     private User user;
     private Owner owner;
     private String name;
     private String country;
     private String zip;
     private String city;
     private String street;
     private String number;
     private Set<Locum> locums = new HashSet<Locum>(0);

    public Gallery() {
    }

	
    public Gallery(User user, String name) {
        this.user = user;
        this.name = name;
    }
    public Gallery(User user, Owner owner, String name, String country, String zip, String city, String street, String number, Set<Locum> locums) {
       this.user = user;
       this.owner = owner;
       this.name = name;
       this.country = country;
       this.zip = zip;
       this.city = city;
       this.street = street;
       this.number = number;
       this.locums = locums;
    }
   
     @Id @GeneratedValue(strategy=IDENTITY)
    
    @Column(name="id", unique=true, nullable=false)
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
@ManyToOne(fetch=FetchType.EAGER)
    @JoinColumn(name="user_id", nullable=false)
    public User getUser() {
        return this.user;
    }
    
    public void setUser(User user) {
        this.user = user;
    }
@ManyToOne(fetch=FetchType.EAGER)
    @JoinColumn(name="owner_id")
    public Owner getOwner() {
        return this.owner;
    }
    
    public void setOwner(Owner owner) {
        this.owner = owner;
    }
    
    @Column(name="name", nullable=false)
    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name="country")
    public String getCountry() {
        return this.country;
    }
    
    public void setCountry(String country) {
        this.country = country;
    }
    
    @Column(name="zip", length=10)
    public String getZip() {
        return this.zip;
    }
    
    public void setZip(String zip) {
        this.zip = zip;
    }
    
    @Column(name="city")
    public String getCity() {
        return this.city;
    }
    
    public void setCity(String city) {
        this.city = city;
    }
    
    @Column(name="street")
    public String getStreet() {
        return this.street;
    }
    
    public void setStreet(String street) {
        this.street = street;
    }
    
    @Column(name="number", length=10)
    public String getNumber() {
        return this.number;
    }
    
    public void setNumber(String number) {
        this.number = number;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="gallery")
    public Set<Locum> getLocums() {
        return this.locums;
    }
    
    public void setLocums(Set<Locum> locums) {
        this.locums = locums;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Gallery other = (Gallery) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 53 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }


    @Override
    public String toString() {
        return id + ":" + name;
    }

}


